package com.xr.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Arnold Yand
 * @summary 发送提醒工具类
 * @time 2018/7/25 08:57
 */
public final class ReminderUtil {

  private static final Logger logger = LoggerFactory.getLogger(ReminderUtil.class);

  private static final String DEFAULT_HOOK = "https://oapi.dingtalk.com/robot/send?access_token=0687a31a70c410b040300116691d98e603e51ac8ba9721d0f06488d637e9ef9b";

  public static void sendMessageToDingDingRobot(String title, String msg){
    try {
      String result = HttpUtils.post(DEFAULT_HOOK, Utils.newHashMap(
              "msgtype", "text",
              "text", Utils.newHashMap("content", title + msg)
      ));
      logger.info("发送订订机器人信息成功，标题：{}，返回结果：{}",title, result);
    } catch (Exception e) {
      logger.error("发送订订机器人信息失败" , e);
    }
  }

}
